package com.tanhua.model.mongo;

import cn.hutool.core.util.RandomUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.util.Arrays;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(collection = "dimension")
public class Dimension implements Serializable {
    private ObjectId reportId; //报表id
    private String key; //维度项（外向，判断，抽象，理性）
    private String value; //维度值
    private Double score;

    public static List<Dimension> init(ObjectId reportId) {
        Dimension dimension1 = new Dimension();
        dimension1.setReportId(reportId);
        dimension1.setKey("外向");
        dimension1.setValue(RandomUtil.randomInt(70, 99) + "%");

        Dimension dimension2 = new Dimension();
        dimension2.setKey("判断");
        dimension2.setValue(RandomUtil.randomInt(70, 99) + "%");
        dimension2.setReportId(reportId);

        Dimension dimension3 = new Dimension();
        dimension3.setKey("抽象");
        dimension3.setValue(RandomUtil.randomInt(70, 99) + "%");
        dimension3.setReportId(reportId);

        Dimension dimension4 = new Dimension();
        dimension4.setKey("理性");
        dimension4.setValue(RandomUtil.randomInt(70, 99) + "%");
        dimension4.setReportId(reportId);

        return Arrays.asList(dimension1, dimension2, dimension3, dimension4);
    }
}
